Brief Full Advanced Search Search Tips
|  |  | To access the contents, click the chapter and section titles. Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 Publication Date: 08/01/98 Search this book:
Previous | Table of Contents | Next
## Chapter 20 Alphabet Soup: ODBC, ADO, And More Trying to understand Visual Basic’s database terminology can be frustrating. Here’s a crash course on what all of those acronyms stand for. From the very beginning, Microsoft has viewed database development as one of Visual Basic’s main uses. Over the years, newer and better database tools have been added to Visual Basic to ensure that programmers always have the latest technology at their fingertips. As new tools have been added, however, older tools haven’t been discarded, but instead they’ve been kept as part of Visual Basic to ensure backward-compatibility with older programs. Consequently, Visual Basic’s database toolbox can be rather confusing to a new programmer who is trying to figure out which tool to use for a specific job and how the various tools relate to each other. As they say in baseball, “You can’t tell the players apart without a scorecard.” This chapter is your scorecard for the Visual Basic database game. Why does Visual Basic have so many players? The main reason is that database technology is constantly evolving. As new data access models are introduced, the older models cannot simply be dropped, because they are needed to support older applications that were written using these technologies. ### Some Terminology Undoubtedly, experienced database programmers throw around a lot of weird terms. Before continuing with this chapter, you need to know a few of these terms: • Back end—This part of a database application maintains the data and performs the actual database functions. (Sometimes called server.) This part exchanges commands and data with the client, the part of the database system that the user interacts with. • Client—The part of a database application the user interacts with. (Also called the front end.) The client’s job is to handle the display and entry of data. This part generally does not perform any actual database functions, which are the job of the server, or back end. • Cursor—A temporary, read-only table that holds the results of a query. • Data source—Unfortunately, this term has two meanings that are only partially related. Generally, a data source is the ultimate origin of the data—the name of the file(s) in which the data is located and, when needed, the name of the computer where the files are located. In Visual Basic, data source also refers to the object that provides the data to your program. For example, an ADO Data control can serve as a program’s data source. • Front end—See client • Query—A set of instructions for retrieving, modifying, inserting, or deleting data in a database. • Server—See back end. Also refers to a remote computer where the database’s back end is located. ### Structured Query Language Structured Query Language is almost always referred to as SQL (pronounced “S-Q-L,” not “sequel,” as it is more commonly but incorrectly pronounced). SQL is designed specifically for accessing and manipulating databases, and it has become the de facto standard for database programming. I am not aware of any relational database back end that doesn’t support SQL (although they often support other proprietary languages, as well). SQL originated in 1974 at an IBM research lab as the Structured English Query Language, or SEQUEL. Since then, the language has evolved into today’s SQL. Unfortunately, the plural—SQLs—should probably be used, because no single accepted SQL standard exists. Not only do several SQL “standards” exist, but many vendors have added product-specific extensions (extra features) to SQL for their database programs. Access SQL, supported by the Access database engine, is a good example. While the bulk of the language is common to all the different implementations, differences do exist. Unlike Basic and most other programming languages, SQL is a nonprocedural language, which means that SQL contains no statements or constructs to control the sequence, or order, of program execution. Thus, SQL does not have the equivalent of Basic’s If...Then...Else or Select Case statements, nor does SQL support named procedures. SQL statements are limited to expressing what you want to do; the program that carries out the SQL instructions interprets the statement and returns the result. Before going any further, take a look at a couple of example SQL statements, to get familiar with its structure. These examples work with a table named Clients that has fields named FirstName, LastName, Address, City, State, ZIP, and Telephone. To obtain a list of all the records for individuals in New York, the following SQL statement is used:
    SELECT * FROM Client WHERE State = ‘NY’
Can you see why SQL is described as “English-like”? The meaning of this command is clear: Select all fields from the table named Clients where the State field contains NY. What if you don’t need all the fields in the result? The following SQL statement displays only the FirstName, LastName, and Telephone fields from those records where the State field contains NY:
    SELECT FirstName, LastName, Telephone FROM Client WHERE State = ‘NY’
The following statement goes one step further and sorts the result list by LastName:
    SELECT FirstName, LastName, Telephone FROM Client WHERE State = ‘NY’ _
       ORDER BY LastName
Remember, SQL is not a Visual Basic technology per se, but rather a universal (or nearly universal) database language that Visual Basic supports. The database project in the next few chapters demonstrates how to perform a variety of database manipulations by using SQL. This project doesn’t attempt to cover the entire SQL language—that topic is large enough for its own book. Generally, trying to learn a great deal of SQL right off the bat isn’t a good idea. Start by working through the next few chapters. Then, when venturing out on your own database projects, you can turn to an SQL reference, as needed, to accomplish specific tasks.
Previous | Table of Contents | Next

| Products | Contact Us | About Us | Privacy | Ad Info | Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.